package com.youlu.campus.web.course;

import com.alibaba.fastjson.JSON;
import com.youlu.campus.entity.VO.req.CourseOrderRefundApplyReq;
import com.youlu.campus.service.course.UserCourseOrderService;
import com.yuelin.infrastructure.quantum.common.QResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/mini-app/")
public class CourseOrderController {
    @Autowired
    private UserCourseOrderService courseOrderService;

    /**
     * 课程视频订单退款申请
     *
     * @param request
     * @return
     */
    @PostMapping("/course-order/refund/apply")
    public QResult refundApply(@Validated @RequestBody CourseOrderRefundApplyReq request) {
        log.info("CourseOrderController,refundApply,request param:{}", JSON.toJSONString(request));
        boolean data = courseOrderService.refundApply(request);
        log.info("CourseOrderController,refundApply,response:{}", data);
        return QResult.success(data);
    }
}
